Generally, in a computer system, a hypervisor is started and a plurality of virtual machines are started by the hypervisor. Each virtual machine allocates an actual device, a virtual device, or the like, and operates while accessing the actual device, the virtual device, or the like by operating an application on an operating system (OS).
As the actual device allocated to the virtual machine, there is a peripheral components interconnect (PCI) device. An input/output (I/O) address assigned to a general PCI device is variable. Therefore, in a case where a plurality of PCI devices are mounted on a system, address collision is avoided by assigning different I/O addresses to the respective PCI devices and it is possible to simultaneously handle a plurality of PCI devices by a plurality of virtual machines.
However, in a video device (hereinafter, referred to as a video graphic array (VGA)), an I/O address assigned to the VGA is fixed as opposed to a general PCI device. A device, such as a VGA whose I/O address is fixed, is referred to as a legacy device. Generally, an I/O address assigned to a VGA is fixed on the assumption that only one display is provided in one computer system (for example, a personal computer).
Also, a general PCI device is accessed by a memory mapped I/O (MMIO) method or an I/O address method. In the case of the VGA, an MMIO address (non-fixed) for setting of a frame buffer or VGA is assigned. Furthermore, in the case of the VGA, I/O addresses (for example, 3B0h to 3BBh, 3C0h to 3DFh) for I/O access upon system start-up or the like and memory addresses (for example, 000A0000h to 000BFFFFh) prepared for a frame buffer of image display of the VGA are fixedly assigned.
The virtual machine performs an I/O access to the VGA by using I/O addresses upon start-up. In a case where a plurality of actual VGAs are mounted on one computer system and the separate actual VGAs are allocated to a plurality of virtual machines, it is desired to assign unique I/O addresses to the respective actual VGAs. At this time, I/O addresses assigned to the VGAs are the same fixed value as described above. Even when the I/O addresses are the fixed value, I/O spaces on the respective virtual machines are separate, and therefore, the same fixed I/O address can be assigned to the respective VGAs.
However, since the hypervisor handles the I/O addresses of the plurality of VGAs, which are used by the plurality of respective virtual machines, within one I/O space, address duplication or collision occurs if the same fixed I/O address is assigned to the plurality of VGAs (see FIG. 13). FIG. 13 illustrates a state in which each of two virtual machines VM1 and VM2 requests a legacy access to two different VGAs (VGA cards #1 and #2) to which the same I/O address (for example, 3B0h to 3BBh, 3C0h to 3DFh) is assigned. Therefore, the plurality of VGAs can be simultaneously used on one computer system.
Therefore, in a case where a plurality of VGAs are mounted, only one of the plurality of VGAs is set to be enabled and the remaining VGAs are set to be disabled. The enable/disable switching of the respective VGAs is performed by using a VGA permission bit of a PCI bridge (see FIG. 14). In FIG. 14, one central processing unit (CPU) constituting four virtual machines VM1 to VM4 is connected to four VGA cards #1 to #4 through a chipset and four PCI bridges. For example, in order to enable only the VGA card #2 allocated to the virtual machine VM2, “1” is set to the VGA permission bit of the PCI bridge that connects the virtual machine VM2 and the VGA card #2, and “0” is set to the VGA permission bits of the remaining PCI bridges.
Therefore, since it is impossible to use only one VGA in one computer system, the virtual machine operated by allocating the actual VGA is suppressed to one. Therefore, the actual VGA, which can be allocated to the virtual machine, is at most one in the whole computer system, and it is impossible to handle a plurality of actual VGAs by a plurality of virtual machines.
As a method for suppressing address duplication or collision, a method illustrated in FIG. 15 is considered. In the method illustrated in FIG. 15, virtual VGA cards are allocated to virtual machines VM1 to VM4, respectively. A hypervisor controls an actual VGA, and screen outputs of the respective virtual machines are displayed on a screen of the hypervisor. In this method, since the virtual VGA cards allocated to the virtual machines VM1 to VM4 are VGAs that are created and virtualized by the hypervisor, abundant functions of the actual VGA cannot be all used.
Patent Literature 1 (JP 2004-252591 A) discloses a technology that controls an access from a virtual machine to a PCI device by using an allocation table of the PCI device and the virtual machine. In the technology, in a case where a plurality of legacy devices (for example, VGAs), to which the same fixed I/O address is assigned, are mounted as PCI devices, collision of I/O addresses cannot be avoided as described above. Therefore, the actual VGAs cannot be simultaneously allocated to the plurality of virtual machines, respectively.
Patent Literature 2 (JP 2009-181418 A) discloses a technology that inhibits an access from an I/O device to a virtual server by setting a register in a PCI switch and inhibits an access from a virtual server to an I/O device by using a hot plug mechanism. In the technology, the I/O device (VGA) is temporarily disconnected from the virtual server (virtual machine) and is then reconnected. Since a resetting is performed at the time of re-connection, a resetting for returning to a state prior to the disconnection of the device is required. In a system that simultaneously handles a plurality of VGAs, the access to the VGAs occurs frequently. Therefore, in the case of using the above technology, processing from the disconnection of the VGA to the resetting occurs frequently and the practical performance cannot be expected.